#include <stdio.h>
#include "seqlist.h"
#include "book.h"
#include "menu.h"

int main() {
    SeqList bookList;
    InitSeqList(&bookList);

    int choice;
    while (1) {
        PrintMenu();
        scanf("%d", &choice);
        getchar();

        switch (choice) {
            case 1: AddBook(&bookList); break;
            case 2: DeleteBook(&bookList); break;
            case 3: SearchBookById(&bookList); break;
            case 4: SearchBookByKeyword(&bookList); break;
            case 5: BorrowBook(&bookList); break;
            case 6: ReturnBook(&bookList); break;
            case 7: ShowAllBooks(&bookList); break;
            case 0:
                FreeSeqList(&bookList);
                printf("已退出系统！\n");
                return 0;
            default:
                printf("无效选项！\n");
        }
    }
}